#include<iostream>

using namespace::std;

int main(int argc, char** argv)
{
    int array[10] = {3, 4, 6, 3, 8, -4, 14, 40, 9, 10};
    //int array[10] = {4, 1, 6, 3, 8, -4, 14, 40, 9, 10};
    int size = sizeof(array)/sizeof(array[0]);
    
    int tmp;
    int i, j;
    for(i = 1; i < size; i++) 
    {
       tmp = array[i];
       for(j = i - 1; j >= 0; j--) 
       {
           if(tmp < array[j]) 
           {
               array[j + 1] = array[j];
           }
           else
           {
               break;
           }
       }
       array[j + 1] = tmp;
    }

    for(i = 0; i < size; i++)
    {
        cout << array[i] << " "; 
    }
    cout << endl;

    return 0;
}
